//
//  CustomUITableView.m
//  SYPerfectDemo
//
//  Created by Lssyyy on 2018/5/8.
//  Copyright © 2018年 Lssyyy. All rights reserved.
//

#import "CustomUITableViewVC.h"
#import "ClassifyCell.h"
#import "SYRouter.h"
#import "StandardVC.h"
#import "VTMagicVC.h"
#import "OpenCellVC.h"
#import "CellAddVC.h"
#import "TableHeadView.h"
#import "ImageFilterVC.h"
#import "CoreAnimationVC.h"
#import "XIBVC.h"
#import "APPStoreVC.h"
#import "CCStarryQRCode.h"
#import "CCCardBagVC.h"
#import "PopAnimationVC.h"
#import "DualCardVC.h"
#import "PPLVC.h"
#import "JMCouponViewController.h"
#import "QNPlayerVC.h"
#define FitWidth(x) ceilf(x *ScreenWidth/375)
#define FitHeight(x) ceilf(x *ScreenHeight/667)
@interface CustomUITableViewVC ()
@property (nonatomic,strong) NSMutableArray *vcNameArray;
@property (nonatomic,strong) TableHeadView *headView;
@end

@implementation CustomUITableViewVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
}

- (void)addUI{
    [super addUI];
    
//    _headView.sd_layout
//    .leftEqualToView(self.view)
//    .rightEqualToView(self.view)
//    .topEqualToView(self.view);
//    [_headView setupAutoHeightWithBottomView:self.headView.contentLb bottomMargin:0];
}

- (void)layoutUI{
    [super layoutUI];
}

- (void)config{
    self.title = @"UI类";
    self.view.backgroundColor = RandomColor;
    [self.tableView registerClass:[ClassifyCell class] forCellReuseIdentifier:@"ClassifyCell"];
    
    [self.vcNameArray addObjectsFromArray:[NSArray arrayWithObjects:@"组件化开发",@"开发规范",@"VTMagicVC",@"OpenCell",@"AddCell",@"滤镜",@"CoreAnimation",@"XIB文件",@"应用内部AppStore",@"星民码",@"卡包",@"popAnimation",@"顶部",@"聊天界面",@"瀑布流",@"pickView",@"优惠券",@"七牛播放器",@"外卖信息",nil]];
    [self.tableView reloadData];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _vcNameArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    ClassifyCell *cell = [ClassifyCell dequeueCellWithTableView:tableView indexPath:indexPath];
    [cell configContent:_vcNameArray[indexPath.row]];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    CCCardBagVC *vc = [[CCCardBagVC alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
//    switch (indexPath.row) {
//        case 0:{
//            SYRouter *vc = [[SYRouter alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 1:{
//            StandardVC *vc = [[StandardVC alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 2:{
//            VTMagicVC *vc = [[VTMagicVC alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 3:{
//            OpenCellVC *vc = [[OpenCellVC alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 4:{
//            CellAddVC *vc = [[CellAddVC alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 5:{
//            ImageFilterVC *vc = [[ImageFilterVC alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 6:{
//            CoreAnimationVC *vc = [[CoreAnimationVC alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 7:{
//            XIBVC *vc = [[XIBVC alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 8:{
//            APPStoreVC *vc = [[APPStoreVC alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 9:{
//            CCStarryQRCode *vc = [[CCStarryQRCode alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 10 :{
//            CCCardBagVC *vc = [[CCCardBagVC alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 11 :{
//            PopAnimationVC *vc = [[PopAnimationVC alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 12 :{
//            DualCardVC *vc = [[DualCardVC alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 13 :{
//            Class class = NSClassFromString(@"CommunicationVC");
//            UIViewController *vc = class.new;
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 14 :{
//            PPLVC *vc = [[PPLVC alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 15 :{
//            JMPickVC *vc = [[JMPickVC alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 16:{
//            JMCouponViewController * vc = [[JMCouponViewController alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 17:{
//            QNPlayerVC * vc = [[QNPlayerVC alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        case 18:{
//            JMTakeawayInfoViewController *vc = [[JMTakeawayInfoViewController alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
//            break;
//        }
//        default:
//            break;
//    }
   
}

- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return UITableViewAutomaticDimension;
}

- (NSMutableArray *)vcNameArray{
    if (!_vcNameArray) {
        _vcNameArray = [NSMutableArray array];
    }
    return _vcNameArray;
}

- (TableHeadView *)headView{
    if (!_headView) {
        _headView = [[TableHeadView alloc]init];
    }
    return _headView;
}
@end
